// NestedLayer.dart
import 'package:flutter/material.dart';

class NestedLayer extends StatelessWidget {
  final int depth;

  const NestedLayer({super.key, required this.depth});

  @override
  Widget build(BuildContext context) {
    Widget child = const Text('Inner Text', textDirection: TextDirection.ltr);

    for (int i = 0; i < depth; i++) {
      child = Row(
        children: [child],
      );
    }

    return Scaffold(
      appBar: AppBar(title: Text('嵌套层数：$depth')),
      body: Padding(
        padding: const EdgeInsets.all(12),
        child: Align(
          alignment: Alignment.topLeft,
          child: RepaintBoundary(child: child),
        ),
      ),
    );
  }
}
